#include "thread.h"

MyWorkerThread::MyWorkerThread(chipFrame *frame) : wxThread() {
    m_frame = frame;
    m_count = 0;
    printf("thread created!\n");
}

void MyWorkerThread::OnExit() {
}

void *MyWorkerThread::Entry() {
    for ( m_count = 0; /*!m_frame->Cancelled() &&*/ (m_count < 10); m_count++ ) {
        // check if we were asked to exit
///        if ( TestDestroy() ) break;

        // create any type of command event here
//        wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, WORKER_EVENT );
//        event.SetInt( m_count );

        // send in a thread-safe way
//        wxPostEvent( m_frame, event );

        // wxSleep() can't be called from non-main thread!
        printf("i'm thread %d!\n", m_count);

        wxThread::Sleep(200);
    }

//    wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, WORKER_EVENT );
//    event.SetInt(-1); // that's all
//    wxPostEvent( m_frame, event );

    return NULL;
}
